
<html><HEAD>
<LINK REL=STYLESHEET HREF="default.css" TYPE="text/css">
<TITLE>
Menus and menu items </TITLE>
</HEAD>
<BODY>

<!-- Header -->
<p class="ancestor" align="right"><A HREF="pbugp120.htm">Previous</A>&nbsp;&nbsp;<A HREF="pbugp122.htm" >Next</A>
<!-- End Header -->
<A NAME="CACDIAEFA"></A><h1>Menus and menu items </h1>
<A NAME="TI3324"></A><p>Usually, all windows in an application have menus except child
and response windows. Menus are lists of related commands or options
(menu items) that a user can select in the currently active window.
Each choice in a menu is called a menu item. Menu items display
in a menu bar or in drop-down or cascading menus.</p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>About Menu objects</span> <A NAME="TI3325"></A>Each item in a menu is defined as a Menu object in PowerBuilder.
You can see the Menu object in the list of objects in the Browser's
System tab.</p>
<A NAME="TI3326"></A><h4>Using menus</h4>
<A NAME="TI3327"></A><p>You can use menus you build in PowerBuilder in two ways:<A NAME="TI3328"></A>
<ul>
<li class=fi><b>In the menu bar of windows</b>   Menu bar menus are associated with a window in the Window
painter and display whenever the window is opened.</li>
<li class=ds><b>As pop-up menus</b>   Pop-up menus display only when a script executes the PopMenu
function.
</li>
</ul>
</p>
<A NAME="TI3329"></A><p>Both uses are described in this chapter.</p>
<A NAME="TI3330"></A><h4>Designing menus</h4>
<A NAME="TI3331"></A><p>PowerBuilder gives you complete freedom in designing menus,
but you should follow conventions to make your applications easy
to use. For example, you should keep menus simple and consistent;
group related items in a drop-down menu; make sparing use of cascading
menus and restrict them to one or two levels.</p>
<A NAME="TI3332"></A><p>This chapter describes some guidelines you should follow when
designing menus. A full discussion of menu design is beyond the
scope of this book. You should acquire a book that specifically
addresses design guidelines for graphical applications and apply
the rules when you use PowerBuilder to create your menus.</p>
<A NAME="TI3333"></A><h4>Building menus</h4>
<A NAME="TI3334"></A><p>When you build a menu, you:</p>
<A NAME="TI3335"></A><p><A NAME="TI3336"></A>
<ul>
<li class=fi>Specify the appearance
and behavior of the menu items by setting their properties.</li>
<li class=ds>Build scripts that determine how to respond to events
in the menu items. To support these scripts, you can declare functions,
structures, and variables for the menu.
</li>
</ul>
</p>
<A NAME="TI3337"></A><p>There are two ways to build a menu. You can:<A NAME="TI3338"></A>
<ul>
<li class=fi>Build a new menu from scratch.
See <A HREF="pbugp123.htm#CACDIAEFC">"Building a new menu "</A>.</li>
<li class=ds>Build a menu that inherits its style, functions,
structures, variables, and scripts from an existing menu. You use
inheritance to create menus that are derived from existing menus,
thereby saving yourself coding and time. See <A HREF="pbugp127.htm#CACDIAEFG">"Using inheritance to build
a menu "</A>.
</li>
</ul>
</p>

